$('#login').on('click',function () {
    if($('#username').val() == ''){
        console.log("请输入用户名");
    }else if($('#password').val() == ''){
        console.log("请输入密码");
    }else {
        $.ajax({
            url: contextPath+"/loginUser",
            type: "POST",
            data:{'username':$("#username").val(),'password':$("#password").val()},
            xhrFields:{withCredentials:true},
            success: function(data) {
                console.log(data.message);
                if(data.message == "登录成功!"){
                    window.location.href='register.html';
                }else{
                    bootbox.alert({
                        message:data.message,
                        size:'small'
                    });
                }
            }
        });
    }
});
$('#register').on('click',function (){
    $('.userlogin').hide();
    $('.userregister').show();
});